{include file="public/header" /}
<style type="text/css">
/* TAB */
.nav-tabs.nav>li>a {
    padding: 10px 25px;
    margin-right: 0;
}
.nav-tabs.nav>li>a:hover,
.nav-tabs.nav>li.active>a {
    border-top: 3px solid #1ab394;
    padding-top: 8px;
}
.nav-tabs>li>a {
    color: #A7B1C2;
    font-weight: 500;  
    margin-right: 2px;
    line-height: 1.42857143;
    border: 1px solid transparent;
    border-radius: 0;
}
</style>

<div id="modal-edit" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content radius">
            <div class="modal-header">
                <h3 class="modal-title">规则编辑</h3>
                <a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" name="edit_member" id="edit_member" method="post" action="/index.php/admin/member/edit_member.html">

                    <div class="form-group">
                        <label class="col-sm-3 control-label">规则名称：</label>
                        <div class="input-group col-sm-4">
                            <input id="account" type="text" class="form-control" name="姓名" value="问候" placeholder="请输入账号">
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">关键词：</label>
                        <div class="input-group col-sm-4">
                            <input id="nickname" type="text" class="form-control" name="nickname" value="你好,在干什么,忙吗,您好" placeholder="多个用(,)逗号隔开">
                        </div>
                    </div>

                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">回复内容：</label>
                        <div class="input-group col-sm-4">
                            <textarea id="nickname" type="text" class="form-control" name="nickname" >您好，我一直都在！</textarea>
                        </div>
                    </div>


                </form>
            </div>
            <div class="modal-footer">
                <button class="btn btn-info" data-dismiss="modal" aria-hidden="true">提交</button>
                <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
            </div>
        </div>
    </div>
</div>
<body class="gray-bg">
<div class="wrapper wrapper-content animated">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>自动回复</h5>
                </div>
                <div class="ibox-content">           
                    <div class="panel-body">
                        <div class="builder-tabs builder-form-tabs">
                            <ul class="nav nav-tabs">
                                <li class="active"><a href="{:url('autoreply')}">自定义回复</a></li>
                                <li ><a href="{:url('autoreplyadd')}">添加自定义回复</a></li>
                            </ul>
                        </div>
                        <div class="form-group"></div>
                        <div class="row">
                            <div class="col-xs-12">
                                <div class="example-wrap">
                                    <div class="example">
                                        <table class="table table-bordered table-hover">
                                            <thead>
                                            <tr class="long-tr">
                                                <th>ID</th>
                                                <th>规则名称</th>
                                                <th>关键词</th>
                                                <th>状态</th>
                                                <th>操作</th>
                                            </tr>
                                            </thead>

                                            {foreach $list as $v}
                                            <tr class="long-td">
                                                <td>{$v.id}</td>
                                                <td>{$v.name}</td>
                                                <td>{$v.keywords}</td>
                                                <td>
                                                    {eq name="$v.status" value="1"}
                                                    <a href="javascript:;" onclick="status({$v.id});">
                                                        <div id="zt{$v.id}" ><span class="label label-info">开启</span></div>
                                                    </a>
                                                    {else/}
                                                    <a href="javascript:;"  onclick="status({$v.id});">
                                                        <div  id="zt{$v.id}"><span class="label label-danger">禁用</span></div>
                                                    </a>
                                                    {/eq}
                                                </td>
                                                <td>
                                                    <a href="javascript:;" onclick="edit('{:URL('autoreplyeditor',['id'=>$v['id']])}')" class="btn btn-primary btn-outline btn-xs"><i class="fa fa-eye"></i> 编辑</a>&nbsp;&nbsp;
                                                    <a href="javascript:;" onclick="del({$v.id})" class="btn btn-danger btn-xs"><i class="fa fa-trash-o"></i> 删除</a>
                                                </td>
                                            </tr>
                                            {/foreach}












                                        </table>
                                        <div id="AjaxPage" style=" text-align: right;"></div>
                                        <div id="allpage" style=" text-align: right;"></div>
                                    </div>
                                </div>

                             </div>
                        </div>

                </div>
				</div>

                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}

<script type="text/javascript">

    function modaledit(){
        $("#modal-edit").modal("show");
    }
    function modalaudit(){
        $("#modal-audit").modal("show");
    }

    //编辑会员组
    function edit(url){
        location.href = url;
    }

    //删除会员组
    function del(id){

        layer.confirm('确认删除此条记录吗?', {icon: 3, title:'提示'}, function(index){
            $.getJSON('{:URL("autoreplydel")}', {'id' : id}, function(res){
                if(res.code == 1){
                    layer.msg(res.msg,{icon:1,time:1500,shade: 0.1});
                    window.location.href="{:url('autoreply')}";
                }else{
                    layer.msg(res.msg,{icon:0,time:1500,shade: 0.1});
                }
            });
            layer.close(index);
        })
    }

    //会员组状态
    function status(id){
        lunhui.status(id,'{:URL("status")}');
    }


</script>
</body>
</html>
